<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/22
 * Time: 16:44
 */

class History extends ADM_Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 主程序
     */
    public function index()
    {
        if (empty($this->baseId)) {
            echo 'page error';
            return false;
        }

        $q = $this->db->get_where('base_bill_apply', ['baseId' => $this->baseId]);
        $rows = $q->result_array();
        if (!empty($rows)) foreach ($rows as &$row) {
            $row['total'] = money_format('%i', $row['total'] / 100);
            $row['refund'] = money_format('%i', $row['refund'] / 100);
            $row['delivery'] = money_format('%i', $row['delivery'] / 100);
            $row['left'] = money_format('%i', $row['left'] / 100);
            $row['fx'] = money_format('%i', $row['fx'] / 100);
        }
        $this->load->view('admin/money/purchaser/history.html', ['data' => $rows]);
    }
}